﻿using System;
using System.Linq;
using Wicresoft.RDW.Presentation;

namespace Wicresoft.RDW.Announcement
{
    public partial class List : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            pager.PageChange += new Wicresoft.RDW.UserControls.PagerControl.PageRefresh(PagerControll_PageChange);
            if (!IsPostBack)
            {
                pager.CurrentPageIndex = 0;
                PagerControll_PageChange(pager.CurrentPageIndex);
            }
        }
        protected void PagerControll_PageChange(int pageIndex)
        {
            string language = Language.ToString();
            var dataPagerSource = AnnouncementPresent.GetPaged(pageIndex, pager.PageSize, p => p.Language.Contains(language),p=>p.CreateTime,true);
            lsvAnnouncement.DataSource = dataPagerSource;
            lsvAnnouncement.DataBind();
            pager.IntialProperties(dataPagerSource.TotalCount);
        }
    }
}